package PUBSUB_TWO.pubsubJmsTemplate;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class MyListenner implements MessageListener {
    public void onMessage(Message message) {
        if (message instanceof TextMessage) {
            String body;
            try {
                body = ((TextMessage) message).getText();
                System.out.println(body);
            } catch (JMSException e) {
                e.printStackTrace();
            }
        } else {
            System.out.println("Unexpected message type: " + message.getClass());
        }
    }
}
